(1) Field of the Invention
This invention relates to an image processing apparatus and method, and more particularly, to an image processing apparatus and method for compression-encoding image data in the Joint Photographic coding Experts Group (JPEG) format.
(2) Description of the Related Art
JPEG is one of methods for effectively compression-encoding image data.
FIG. 1 shows a configuration of a conventional image processing apparatus which compression-encodes image data in the JPEG format.
The conventional image processing apparatus 50 has a Discrete Cosine Transformation (DCT) unit 51, a quantizer 52, and a Huffman encoder 53. The DCT unit 51 performs DCT. The quantizer 52 quantizes DCT coefficients resulted from the DCT. The Huffman encoder 53 performs compression-encoding with Huffman codes.
In the JPEG standard, an original image is divided into a plurality of 8×8-pixel blocks, and each block is compression-encoded. This block is a basic unit for the JPEG format and is called a Minimum Coded Unit (MCU) hereinafter. The DCT unit 51 performs the DCT on each received MCU to calculate DCT coefficients. The calculated DCT coefficients are quantized by the quantizer 52 using a quantization table 52a. The Huffman encoder 53 receives the quantized DCT coefficients and performs entropy encoding with Huffman codes, thereby creating an encoded signal comprising “1” and “0” codes. This process is performed on all MCUs.
By the way, you may want to adjust the amount of codes (the amount of bits) of image data to be encoded, for example, for storing the image data in a memory medium with a limited capacity for a Digital Still Camera (DSC) or a Digital Video Camera (DVC). To obtain a target amount of bits, different quantization table values (quantization threshold values) are applied to prescribed sub-areas in related art (for example, refer to Japanese Unexamined Patent Publication No. 2003-304402). However, since the JPEG standard allows only one quantization table to be set for each component (luminance, color difference) of each image, this technique is difficult to be put to practical use.
At present, two-pass encoding is employed, in which encoding is performed on all MCUs once, a quantization table is changed based on the amount of bits obtained by the encoding, and then the encoding is performed again. This two-pass encoding technique, however, causes heavy loads and takes time.